package com.example.demo.mapper;

import com.example.demo.entity.CoursePO;
import com.example.demo.entity.UserCourse;
import com.example.demo.entity.UserOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface UserCourseMapper {

    @Insert("insert into tb_user_course (userId,courseId,createTime,updateTime) " +
            "values(#{userId} ,#{courseId} ,#{createTime} ,#{updateTime} )")
    void addCourse(UserCourse userCourse);

    @Select("select id from tb_user_course where userId = #{id} ")
//    List<UserCourse> selectCourseListByUserId(String id);
    List<Long> selectCourseListByUserId(String id);

    //查询tb_user_course表
    @Select("select * from tb_user_course where userId = #{userId}")
    List<UserCourse> selectCourseList(@Param("userId") String userId);
}
